<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html id="iframe">
	<head>
		<meta charset="UTF-8">
		
		<title><?php echo C('sitename');?></title>
		<meta name="keywords" content="<?php echo C('keyword');?>">
		<meta name="description" content="<?php echo C('content');?>">
		
		<meta name="renderer" content="webkit">
		<meta name="format-detection" content="telephone=no,email=no"/>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
		<meta name="telephone=no"  content="format-detection">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no" />
		
		<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
		<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> 
		<META HTTP-EQUIV="Expires" CONTENT="0">
		
		<link rel="stylesheet" type="text/css" href="/Public/Home/css/lib.css"/>
		<link rel="stylesheet" type="text/css" href="/Public/Home/css/public.css"/>
		<link rel="stylesheet" type="text/css" href="/Public/Home/css/page.css"/>
	</head>
	<style>
		/*分页样式*/
		.pages a,.pages span {
		    display:inline-block;
		    padding:4px 7px;
		    margin:0 2px;
		    border:1px solid #D5D4D4;
		    -webkit-border-radius:1px;
		    -moz-border-radius:1px;
		    border-radius:1px;
		}
		.pages a,.pages li {
		    display:inline-block;
		    list-style: none;
		    text-decoration:none; color:#15AF11;
		}
		
		.pages a:hover{
		    border-color:#15AF11;
		}
		.pages span.current{
		    background:#15AF11;
		    color:#FFF;
		    font-weight:700;
		    border-color:#15AF11;
		}
		.pages{
			margin-top: 8px;
			text-align: center;
		}
		/*分页样式*/
	</style>
	<body>
		<div class="record">
			<div class="record-top">
				<p class="intro">
					<span>会员:<i><?php echo ($userinfo["nickname"]); ?></i></span>
					<span>点数:<i><?php echo ($userinfo["points"]); ?></i></span>
					<span>代理:<i>DS1688</i></span>
					<span>编号:<i>PKW<?php echo ($userinfo["id"]); ?></i></span>
				</p>
				<p class="lable">
					<a href="<?php echo U('Home/Circle/record');?>?t=1"><span><?php echo (date("m-d",$today)); ?></span></a>
					<a href="<?php echo U('Home/Circle/record');?>?t=2"><span><?php echo (date("m-d",$today-86400)); ?></span></a>
					<a href="<?php echo U('Home/Circle/record');?>?t=3"><span><?php echo (date("m-d",$today-86400*2)); ?></span></a>
					<a href="<?php echo U('Home/Circle/record');?>?t=4"><span>账务</span></a>
				</p>
			</div>
			<div class="record-content">
				<?php if(empty($list)): ?><p class="record-no"><span>
						<?php if($t == 1): echo (date("m-d",$today)); endif; ?>
						<?php if($t == 2): echo (date("m-d",$today-86400)); endif; ?>
						<?php if($t == 3): echo (date("m-d",$today-86400*2)); endif; ?>
						 无资料
					</span></p>
					<?php else: ?>
					<?php if($t == 4): ?><table>
							<thead>
								<tr>
									<th>#</th>
									<th>时间</th>
									<!--<th>单号</th>-->
									<th>内容</th>
									<th>进项</th>
									<th>出项</th>
									<th>余额</th>
								</tr>	
							</thead>
							<tbody>
								<tr>
									<td colspan="7"><?php echo (date("Y-m-d",$today)); ?></td>
								</tr>
								<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
										<td><?php echo ($i); ?>.</td>
										<td><?php echo (date("H:i:s",$vo["time"])); ?></td>
										<!--<td><?php echo (mb_substr($vo["time"],3,8,utf8)); ?></td>-->
										<td>期号:<?php echo ($vo["number"]); ?>,<?php echo ($vo["jincai"]); ?></td>
										<td><?php echo ($vo["add_points"]); ?></td>
										<td><?php echo ($vo["del_points"]); ?></td>
										<td><?php echo ($vo["balance"]); ?></td>
									</tr><?php endforeach; endif; else: echo "" ;endif; ?>
							</tbody>
						</table>
						<?php else: ?>
						<table>
							<?php if(is_array($list1)): $i = 0; $__LIST__ = $list1;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><thead>
									<tr>
										<th colspan="6">
											<?php
 $periodnumber = $vo['number']; $awardnumbers = M('number')->where("periodnumber = $periodnumber")->find(); $data = explode(',',$awardnumbers['awardnumbers']); for($i=0;$i<count($data);$i++){ if($data[$i]<10){ $data[$i] = substr($data[$i],1); } } ?>
											<span>期号：<?php echo ($vo["number"]); if($number == $vo['number']): ?>(未开奖)
												<?php else: ?>
												(
												<?php if(is_array($data)): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$y): $mod = ($i % 2 );++$i; if($i == 10): echo ($y); ?>
														<?php else: ?>
														<?php echo ($y); ?>,<?php endif; endforeach; endif; else: echo "" ;endif; ?>
												)<?php endif; ?></span>
											<?php if($number == $vo['number']): ?><a class="bt bt-red" onclick="del_all('<?php echo ($vo["number"]); ?>')">全部取消</a><?php endif; ?>
										</th>
									</tr>
								</thead>
								<thead>
									<tr>
										<th>#</th>
										<th>竞猜时间</th>
										<th>竞猜单号</th>
										<th>内容1</th>
										<th>点数</th>
										<th>结果</th>
									</tr>	
								</thead>
								<tbody>
									<?php if(is_array($vo["order"])): $i = 0; $__LIST__ = $vo["order"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$r): $mod = ($i % 2 );++$i;?><tr>
											<td>1.</td>
											<td><?php echo (date("Y-m-d H:i:s",$r["time"])); ?></td>
											<td><?php echo ($r["id"]); ?></td>
											<td><?php echo ($r["jincai"]); ?></td>
											<td><?php echo ($r["del_points"]); ?></td>
											<td>
												<?php if($number == $vo['number']): ?><a class="bt bt-red" onclick="del('<?php echo ($r["id"]); ?>')">取消</a>
													<?php else: ?>
													<?php echo ($r['add_points']-$r['del_points']); endif; ?>
											</td>
										</tr><?php endforeach; endif; else: echo "" ;endif; ?>
								</tbody><?php endforeach; endif; else: echo "" ;endif; ?>
						</table><?php endif; endif; ?>
			</div>
			<div class="pages">
				<?php echo ($show); ?>
			</div>
		</div>
		
		
		<script src='//cdn.bootcss.com/jquery/1.11.3/jquery.js'></script>
		<script src="/Public/layer/layer.js"></script>
		<script>
			function del(id){
				layer.open({
				    content: '您确定要取消吗？'
				    ,btn: ['确认', '取消']
				    ,yes: function(index){
				      	layer.close(index);
				      	$.ajax({
	                       	url: "<?php echo U('Home/Circle/del');?>",
	                       	type: "post",
	                       	data:{'id':id},
	                       	dataType:'json',
	                       	error:function(){
	                       		parent.layer.open({content: '服务器开小差了~',skin: 'msg',time: 2});
		                    },
	                       	success:function(res){
	                       		location.href=location.href;
	                       	}
	                   	});
				    }
				});
			}
			function del_all(number){
				layer.open({
				    content: '您确定要取消吗？'
				    ,btn: ['确认', '取消']
				    ,yes: function(index){
				      	layer.close(index);
				      	$.ajax({
	                       	url: "<?php echo U('Home/Circle/del_all');?>",
	                       	type: "post",
	                       	data:{'number':number},
	                       	dataType:'json',
	                       	error:function(){
	                       		parent.layer.open({content: '服务器开小差了~',skin: 'msg',time: 2});
		                    },
	                       	success:function(res){
	                       		location.href=location.href;
	                       	}
	                   	});
				    }
				});
			}
		</script>
	</body>
</html>